package com.leejw.tradeblogsystem.common;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: jwli3
 * @Desc: 常用工具类
 * @create: 2024-08-22
 **/
public class TradeUtil {


    public static HttpServletRequest getRequest() {
        return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
    }

    public static String getToken() {
        return TradeUtil.getRequest().getHeader(Const.TOKEN_HEADER);
    }



}
